using System;

namespace Pyxis.Toolkit.Windows.Commands
{
	public class CommandExecutionResult
	{
		private readonly Exception mException;
		private readonly bool mSucceded;

		private CommandExecutionResult()
		{
			mSucceded = true;
		}

		private CommandExecutionResult(Exception exception)
		{
			mSucceded = false;
			mException = exception;
		}

		public bool Succeded
		{
			get { return mSucceded; }
		}

		public bool Failed
		{
			get { return !mSucceded; }
		}

		public Exception Exception
		{
			get { return mException; }
		}

		public static CommandExecutionResult FromSuccess()
		{
			return new CommandExecutionResult();
		}

		public static CommandExecutionResult FromException(Exception exception)
		{
			return new CommandExecutionResult(exception);
		}
	}
}